import React from 'react';
import { Scene } from 'react-native-router-flux';
import navBarStyle from '../../../components/navBarStyle';
import store from '../models/members';
import EditMember from './components/editMember';
import MemberDetail from './components/memberDetail';

module.exports = (
  <Scene
    key="familyMemberDetail"
    component={MemberDetail}
    title={({ customerName }) => `${customerName}的家庭成员`}
    path="family/member/:customerId/:id"
    hideTabBar
    back
    renderRightButton={({
      customerId,
      memberId,
      relationType
    }) => {
      if (relationType === 1) {
        return null;
      }
      return <EditMember memberId={memberId} customerId={customerId} />
    }}
    onEnter={({ customerId, memberId }) => store.fetchOne(customerId, memberId)}
    {...navBarStyle}
    store={store}
  />
);
